package com.zlc.common.common.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.http.HttpStatus;

public class BusinessResult {

    private String status;
    private String message;
    private Object data;
    private String code = "200";


    public BusinessResult() {
    }

    public BusinessResult(String message, String status, Object data) {
        this.message = message;
        this.status = status;
        this.data = data;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @JsonIgnore
    public boolean isSuccessful() {
        return String.valueOf(HttpStatus.OK.value()).equals(this.status);
    }

    @JsonIgnore
    public boolean isError() {
        return !this.isSuccessful();
    }

    public String getMessage() {
        return this.message;
    }

    public String getStatus() {
        return this.status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return this.data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
